//1、编写 router/index.js文件
import { createMemoryHistory, createRouter } from 'vue-router'
import Book from "@/components/Book.vue";
import Login from "@/components/Login.vue";
import Register from "@/components/Register.vue";
import Cart from "@/components/Cart.vue";
import Settlement from "@/components/Settlement.vue";

//2、配置路由表信息
const routes = [{
    path: '/',   //根目录访问地址
    name: 'book',
    component: Book
}, {
    path: '/login',  //登录
    name: 'login',
    component: Login
},{
    path: '/register',
    name: 'register',
    component: Register  //注册
},{
    path: '/cart',
    name: 'cart',
    component: Cart
},{
    path: '/settlement',
    name: 'settlement',
    component: Settlement
}
]

//创建路由器
const router = createRouter({
    history: createMemoryHistory(),
    routes,
})
export { router }